import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path:'/',
      redirect:'/film'
    },
    {
      path: "/film",
      name: "film",
      meta:{},
      component: () => import('../views/FilmView.vue'),
      children:[
        {
          path: "/film",
          redirect:'/film/nowPlaying'
        },
        {
          path:'nowPlaying',
          name:'nowPlaying',
          component: () => import('../components/nowPlaying.vue'),
          // children:[
            
          // ]
        },
        {
          path:'comingSoon',
          name:'comingSoon',
          component: () => import('../components/FilmList.vue'),
        }
       
      ]
    },
    {
      path: "/cinema",
      name: "cinema",
      meta:{},
      component: () => import('../views/CinemaView.vue'),
    },
    {
      path: "/news",
      name: "news",
      meta:{isTab:true},
      component: () => import('../views/NewsView.vue'),
    },
    {
      path: "/mine",
      name: "mine",
      meta:{},
      component: () => import('../views/MineView.vue'),
    },
    {
      path: "/login",
      name: "login",
      component: () => import('../views/Login.vue'),
    },
    // 动态路由
    {
      path:'/detail/:id(\\d{4})',
      name:'DetailPage',
      component: () => import('../components/DetailPage.vue'),
    },
     /* 404 */
     {
      path: "/:pm(.*)*",
      name:"notfound",
      component:() => import('../views/NotFound.vue'),
    }
  ]
})

export default router
